<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>pkcheck</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="polkit Reference Manual">
<link rel="up" href="manpages.html" title="Part VI. Manual Pages">
<link rel="prev" href="polkitd.8.html" title="polkitd">
<link rel="next" href="pkaction.1.html" title="pkaction">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="polkitd.8.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="manpages.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">polkit Reference Manual</th>
<td><a accesskey="n" href="pkaction.1.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="pkcheck.1"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">pkcheck</span></h2>
<p>pkcheck — Check whether a process is authorized</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p><code class="command">pkcheck</code>  [<code class="option">--version</code>] [<code class="option">--help</code>]</p></div>
<div class="cmdsynopsis"><p><code class="command">pkcheck</code>  [<code class="option">--list-temp</code>]</p></div>
<div class="cmdsynopsis"><p><code class="command">pkcheck</code>  [<code class="option">--revoke-temp</code>]</p></div>
<div class="cmdsynopsis"><p><code class="command">pkcheck</code>   
        <code class="option">--action-id</code>
        <em class="replaceable"><code>action</code></em>
        { 
          <code class="option">--process</code>
           { 
              <em class="replaceable"><code>pid</code></em>
              |   
              <em class="replaceable"><code>pid,pid-start-time</code></em>
             }
          |   
          <code class="option">--system-bus-name</code>
          <em class="replaceable"><code>busname</code></em>
         } [ 
          <code class="option">--allow-user-interaction</code>
         ] [ 
          <code class="option">--enable-internal-agent</code>
         ] [ 
          <code class="option">--detail</code>
          <em class="replaceable"><code>key</code></em>
          <em class="replaceable"><code>value</code></em>
         ...]</p></div>
</div>
<div class="refsect1">
<a name="pkcheck-descsription"></a><h2>DESCRIPTION</h2>
<p>
      <span class="command"><strong>pkcheck</strong></span> is used to check whether a process, specified by
      either <code class="option">--process</code> or <code class="option">--system-bus-name</code>,
      is authorized for <em class="replaceable"><code>action</code></em>. The <code class="option">--detail</code>
      option can be used zero or more times to pass details about <em class="replaceable"><code>action</code></em>.
      If <code class="option">--allow-user-interaction</code> is passed, <span class="command"><strong>pkcheck</strong></span> blocks
      while waiting for authentication.
    </p>
<p>
      The invocation <span class="command"><strong>pkcheck --list-temp</strong></span> will list
      all temporary authorizations for the current session and
      <span class="command"><strong>pkcheck --revoke-temp</strong></span> will revoke all
      temporary authorizations for the current session.
    </p>
<p>
      This command is a simple wrapper around the PolicyKit D-Bus interface; see the
      D-Bus interface documentation for details.
    </p>
</div>
<div class="refsect1">
<a name="pkcheck-return-value"></a><h2>RETURN VALUE</h2>
<p>
      If the specified process is
      authorized, <span class="command"><strong>pkcheck</strong></span> exits with a return value
      of 0. If the authorization result contains any details, these
      are printed on standard output as key/value pairs using
      environment style reporting, e.g. first the key followed by a an equal sign, then the
      value followed by a newline.
</p>
<pre class="programlisting">
KEY1=VALUE1
KEY2=VALUE2
KEY3=VALUE3
...</pre>
<p>
      Octects that are not in [a-zA-Z0-9_] are escaped using octal codes prefixed
      with <span class="emphasis"><em>\</em></span>.
      For example, the UTF-8 string <span class="emphasis"><em>føl,你好</em></span> will be printed
      as <span class="emphasis"><em>f\303\270l\54\344\275\240\345\245\275</em></span>.
    </p>
<p>
      If the specificied process is not
      authorized, <span class="command"><strong>pkcheck</strong></span> exits with a return value
      of 1 and a diagnostic message is printed on standard error. Details
      are printed on standard output.
    </p>
<p>
      If the specificied process is not
      authorized because no suitable authentication agent is available or if the
      <code class="option">--allow-user-interaction</code> wasn't passed, <span class="command"><strong>pkcheck</strong></span>
      exits with a return value of 2 and a diagnostic message is printed on standard error.
      Details are printed on standard output.
    </p>
<p>
      If the specificied process is not authorized because the
      authentication dialog / request was dismissed by the user,
      <span class="command"><strong>pkcheck</strong></span> exits with a return value of 3 and a
      diagnostic message is printed on standard error.  Details are
      printed on standard output.
    </p>
<p>
      If an error occured while checking for authorization, <span class="command"><strong>pkcheck</strong></span> exits
      with a return value of 127 with a diagnostic message printed on standard error.
    </p>
<p>
      If one or more of the options passed are malformed, <span class="command"><strong>pkcheck</strong></span> exits
      with a return value of 126. If stdin is a tty, then this manual page is also shown.
    </p>
</div>
<div class="refsect1">
<a name="pkcheck-notes"></a><h2>NOTES</h2>
<p>
      Since process identifiers can be recycled, the caller should always use
      <em class="replaceable"><code>pid,pid-start-time</code></em> to specify the process
      to check for authorization when using the <code class="option">--process</code> option.
      The value of <em class="replaceable"><code>pid-start-time</code></em>
      can be determined by consulting e.g. the
      <span class="citerefentry"><span class="refentrytitle">proc</span>(5)</span>
      file system depending on the operating system. If only <em class="replaceable"><code>pid</code></em>
      is passed to the <code class="option">--process</code> option, then <span class="command"><strong>pkcheck</strong></span>
      will look up the start time itself but note that this may be racy.
    </p>
</div>
<div class="refsect1">
<a name="pkcheck-auth-agent"></a><h2>AUTHENTICATION AGENT</h2>
<p>
      <span class="command"><strong>pkcheck</strong></span>, like any other PolicyKit
      application, will use the authentication agent registered for
      the process in question. However, if no authentication agent is
      available, then <span class="command"><strong>pkcheck</strong></span> can register its own
      textual authentication agent if the option
      <code class="option">--enable-internal-agent</code> is passed.
    </p>
</div>
<div class="refsect1">
<a name="pkcheck-author"></a><h2>AUTHOR</h2>
<p>
      Written by David Zeuthen <code class="email">&lt;<a class="email" href="mailto:davidz@redhat.com">davidz@redhat.com</a>&gt;</code> with
      a lot of help from many others.
    </p>
</div>
<div class="refsect1">
<a name="pkcheck-bugs"></a><h2>BUGS</h2>
<p>
      Please send bug reports to either the distribution or the
      polkit-devel mailing list,
      see the link <a class="ulink" href="http://lists.freedesktop.org/mailman/listinfo/polkit-devel" target="_top">http://lists.freedesktop.org/mailman/listinfo/polkit-devel</a>
      on how to subscribe.
    </p>
</div>
<div class="refsect1">
<a name="pkcheck-see-also"></a><h2>SEE ALSO</h2>
<p>
      <span class="citerefentry"><span class="refentrytitle">polkit</span>(8)</span>,
      <span class="citerefentry"><span class="refentrytitle">pkaction</span>(1)</span>,
      <span class="citerefentry"><span class="refentrytitle">pkexec</span>(1)</span>,
      <span class="citerefentry"><span class="refentrytitle">pkttyagent</span>(1)</span>
    </p>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>